package com.jwkj.collector.modbus.response;


import com.jwkj.collector.modbus.base.ModbusFunction;
import com.jwkj.collector.modbus.util.ByteUtils;

/**
 * 单笔写入命令响应结果
 */
public class OneWriteResponse extends MultiWriteResponse {

    int value;

    /**
     * 构造响应对象
     */
    public OneWriteResponse(byte addr, int start, int length) {
        super(addr, ModbusFunction.ONE_WRITE, start, length);
    }

    /**
     * @param buf
     */
    public OneWriteResponse(byte[] buf) {
        super(buf);
        this.value = ByteUtils.bytes2Int(this.datas, 2, 2);
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

}